package engine;

import java.awt.Point;

import java.util.List;
import java.util.ArrayList;

import resources.manager.ResourceManager;

/**
 * Represents a level.
 */
public class Level
{
    private static final String DELIMETER = ",";
    private ResourceManager myManager = ResourceManager.getInstance();
    private int myFishCount;
    private ArrayList<Point> myPoints;
    private double mySpawnx, mySpawny;
    private int myNumberOfPoints;


    public Level(String level){
        System.out.println(level);
        myPoints = new ArrayList<Point>();
        myManager.addResourcesFromFile(level);
        myFishCount = myManager.getInteger("fish_to_save");
        mySpawnx = myManager.getDouble("path_inc_x");
        mySpawny = myManager.getDouble("path_inc_y");
        myNumberOfPoints = myManager.getInteger("num_path_points");
        String[] temp = myManager.getStringArray("points", DELIMETER);
        for(int i=0; i<temp.length-1; i=i+2){
            /*
             * The *0.71 and mySpawnx, mySpawny are from ProgBob's original
             * code. Don't ask questions.
             */
            myPoints.add(new Point((int)((Integer.parseInt(temp[i])+mySpawnx)*.71), (int)((Integer.parseInt(temp[i+1])+mySpawny-10)*0.71)));
        }



    }



    protected ArrayList<Point> getPoints(){
        return myPoints;
    }

    private void fillList(String[] temp){
    }

}
